[MINOR][CORE] Fix swapped depth/width formulas in CountMinSketch class doc#56897
Closed
LuciferYang wants to merge 1 commit into
Closed
[MINOR][CORE] Fix swapped depth/width formulas in CountMinSketch class doc#56897LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
…s doc The class doc had `d` and `w` swapped relative to the implementation, which sets `width = ceil(2 / eps)` and `depth = ceil(-log(1 - confidence) / log(2))`.
Member
|
LGTM. The corrected formulas match |
MaxGekk
approved these changes
Jun 30, 2026
Member
|
+1, LGTM. Merging to master/4.x. |
MaxGekk
pushed a commit
that referenced
this pull request
Jun 30, 2026
…s doc ### What changes were proposed in this pull request? This PR fixes the class-level Javadoc of `org.apache.spark.util.sketch.CountMinSketch`, which assigned the two table dimensions to the wrong symbols. The doc previously read: ``` d = ceil(2 / eps) w = ceil(-log(1 - confidence) / log(2)) ``` but the implementation (`CountMinSketchImpl`, the `(eps, confidence, seed)` constructor) actually sets: ```java this.width = (int) Math.ceil(2 / eps); this.depth = (int) Math.ceil(-Math.log1p(-confidence) / Math.log(2)); ``` i.e. `width` is derived from `eps` and `depth` from `confidence` -- the opposite of what the doc stated. The fix swaps the two lines so the doc matches the code: ``` w = ceil(2 / eps) d = ceil(-log(1 - confidence) / log(2)) ``` ### Why are the changes needed? Doc fix ### Does this PR introduce _any_ user-facing change? No. Documentation-only change; no behavior, serialization, or API impact. ### How was this patch tested? Pass Github Actions ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code Closes #56897 from LuciferYang/minor-countminsketch-doc-fix. Authored-by: YangJie <yangjie01@baidu.com> Signed-off-by: Max Gekk <max.gekk@gmail.com> (cherry picked from commit 1409d88) Signed-off-by: Max Gekk <max.gekk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR fixes the class-level Javadoc of
org.apache.spark.util.sketch.CountMinSketch, which assigned the two table dimensions to the wrong symbols. The doc previously read:but the implementation (
CountMinSketchImpl, the(eps, confidence, seed)constructor) actually sets:i.e.
widthis derived fromepsanddepthfromconfidence-- the opposite of what the doc stated. The fix swaps the two lines so the doc matches the code:Why are the changes needed?
Doc fix
Does this PR introduce any user-facing change?
No. Documentation-only change; no behavior, serialization, or API impact.
How was this patch tested?
Pass Github Actions
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code